package com.huaxin.device.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huaxin.device.models.ElectricalEquipment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface ElectricalEquipmentMapper extends BaseMapper<ElectricalEquipment> {

    @Select("SELECT COUNT(*) > 0 FROM electrical_equipment WHERE model_id = #{modelId}")
    boolean existsByModelId(String modelId);

    @Select("SELECT COUNT(*) > 0 FROM electrical_equipment WHERE category_id = #{categoryId}")
    boolean existsByCategoryId(String categoryId);

    @Select("SELECT COUNT(*) > 0 FROM electrical_equipment WHERE room_id = #{roomId}")
    boolean existsByRoomId(String roomId);

    @Select("SELECT COUNT(*) > 0 FROM electrical_equipment WHERE well_id = #{wellId}")
    boolean existsByWellId(String wellId);

    @Select("SELECT COUNT(*) > 0 FROM electrical_equipment WHERE cabinet_id = #{cabinetId}")
    boolean existsBySwitchCabinetId(String cabinetId);
}